package com.hp.controller;

import cn.hutool.captcha.CaptchaUtil;
import cn.hutool.captcha.CircleCaptcha;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@Controller
public class CheckCodeController {
    @RequestMapping("/checkCode")
    public void checkCode(HttpSession session, HttpServletResponse response) throws IOException {
        CircleCaptcha circleCaptcha= CaptchaUtil.createCircleCaptcha(200,100,4,5);
        String code=circleCaptcha.getCode();
        session.setAttribute("code",code);
        circleCaptcha.write(response.getOutputStream());
    }
}
